﻿namespace MvcScriptManager.UniqueKeyEncoding
{
    using System.Web;

    /// <summary>
    /// Interface for Encoder classes, designed to handle creating unique keys for
    /// ScriptManager file references
    /// </summary>
    public interface IUniqueKeyEncoder
    {
        /// <summary>
        /// Creates the unique key from the ScriptReference
        /// </summary>
        /// <param name="reference">The <see cref="ScriptReference"/></param>
        /// <param name="context">The HttpContext for the current request</param>
        /// <returns>The unique key for the file</returns>
        string EncodeUniqueKey(ScriptReference reference, HttpContext context);

        /// <summary>
        /// Rebuilds the ScriptReference object from a unique key
        /// </summary>
        /// <param name="uniqueKey">The unique key for the file</param>
        /// <param name="context">The HttpContext for the current request</param>
        /// <returns>The <see cref="ScriptReference"/></returns>
        ScriptReference DecodeUniqueKey(string uniqueKey, HttpContext context);
    }
}
